package com.qf;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class JedisUtils {
    private static JedisPool jp;

    static {
        JedisPoolConfig config = new JedisPoolConfig();
        //初始连接
        config.setMaxIdle(5);
        //最大连接
        config.setMaxTotal(50);
        //最大等待超时
        config.setMaxWaitMillis(3000);
        //创建连接池
        jp = new JedisPool(config,"192.168.247.132",6379);
    }

    public static Jedis getJedis(){
        Jedis resource = jp.getResource();
        resource.auth("123456");
        return resource;
    }
}
